package com.chenhan.system.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.chenhan.common.core.utils.StreamUtils;
import com.chenhan.common.core.support.BaseServiceImpl;
import com.chenhan.system.domain.SysRole;
import com.chenhan.system.mapper.RoleMapper2;
import com.chenhan.system.service.RoleService2;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.List;

@Service
@RequiredArgsConstructor
public class RoleServiceImpl2 extends BaseServiceImpl<RoleMapper2, SysRole> implements RoleService2 {


    @Override
    public List<String> selectRoleKeysByRoleIds(Collection<Long> roleIds) {
        List<SysRole> roleDOs = baseMapper.selectList(Wrappers.<SysRole>lambdaQuery().in(SysRole::getRoleId, roleIds));
        return StreamUtils.convertList(roleDOs, SysRole::getRoleKey);
    }
}
